﻿using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using Common;

namespace Common
{
    public class ActionBase : IBase
    {
        private bool end = false;
        public bool End
        {
            get { return end; }
            set { end = value; }
        }
        public ActionParameter Parameter;
        public IUnit Handle;
        public Vector2 Excursion;
        public AnimationState Animation;
        public OnBeatDefine Beat = OnBeatDefine.Basic;
        public virtual UInt16 Id
        {
            get 
            {
                ushort id = 0;
                string className = this.ToString();
                int index = className.IndexOf("_");
                if (index > -1) ushort.TryParse(className.Substring(index + 1), out id);
                return id; 
            }
        }
        public virtual void Update() { }
        public virtual void LateUpdate() { }
        public virtual void FixedUpdate() { }
        public virtual void Delete() { }
        public virtual void Start()
        {
            AppInterface.ActionModule.RegisterAction(this);
        }
    }
}

